package com.yinhai.message.manage.register.dao;

import java.util.List;

import com.yinhai.core.service.ta3.domain.dao.HibernateDAO;
import com.yinhai.message.manage.register.po.SmsConfigPo;
import com.yinhai.message.manage.register.vo.SmsConfigVo;

/**
*
*@author lanyc
*@version created: 2017年4月4日下午5:53:32
*/
public class SmsConfigDaoImpl extends HibernateDAO<SmsConfigPo> implements ISmsConfigDao {

	@Override
	public List<SmsConfigVo> queryAllPlatForms() {
		StringBuilder hql = new StringBuilder();
        hql.append("select new com.yinhai.message.manage.register.vo.SmsConfigVo(")
        .append("scp.id,")
        .append("scp.platformName,")
        .append("scp.defaultPlatform,")
        .append("scp.serverIp,")
        .append("scp.serverPort,")
        .append("scp.mainAccount,")
        .append("scp.appName) from com.yinhai.message.manage.register.po.SmsConfigPo scp ");
		 return super.selectFildsList(hql.toString());
	}

	@Override
	public Integer addPlatForm(SmsConfigPo scp) {
		save(scp);
		return null;
	}

	@Override
	public Integer updatePlatForm(SmsConfigPo scp) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Integer deletePlatForm(String platFormName) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public SmsConfigVo queryDefaultPlatform() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public SmsConfigVo queryPlatformByName(String platformName) {
		StringBuilder hql = new StringBuilder();
        hql.append("select new com.yinhai.message.manage.register.vo.SmsConfigVo(")
        .append("scp.id,")
        .append("scp.platformName,")
        .append("scp.defaultPlatform,")
        .append("scp.serverIp,")
        .append("scp.serverPort,")
        .append("scp.mainAccount,")
        .append("scp.appName) from com.yinhai.message.manage.register.po.SmsConfigPo scp where scp.platformName =? ");
		 return super.selectFiled(hql.toString(),platformName);
	}

}
